<!DOCTYPE html>
<html >
	<head>
		<meta charset="utf-8" />
		<script type="text/javascript" src="../js/angular.js" ></script>
		<title></title>
		<link rel="stylesheet" href="../css/font-awesome/css/font-awesome.css">
	</head>

	<body ng-app="app" >
		<div ng-controller="ctrl" >
			<input type="text" ng-model="search" >
			<table border="1" >
				<tr>
					<td>id</td>
					<td>Name</td>
				</tr>
				<tr ng-repeat="v in items" >
					<td>{{v.id}}</td>
					<td>{{v.name}}</td>
				</tr>
			</table>
		</div>
		<script>
			var app=angular.module("app",[]);
			app.controller("ctrl",["$scope","$filter",function($scope,$filter){
			    var items=[{name:"南宁",id:1},{name:'钦州',id:2},{name:"北海",id:3},{name:"防城",id:4}];
			    $scope.$watch("search",function () {
                    $scope.items=$filter("filter")(items,$scope.search);
                });

			}]);
		</script>
	</body>
</html>
